import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface GetHintMetrics_ {
  /**
   * @description 取数任务中指定的指标模糊搜索内容
   */
  metricsContent?: string;
  /**
   * @description 场景id
   * @format int32
   */
  sceneId?: number;
}
export interface GetSceneDetailById_ {
  /**
   * @description id
   */
  id: number;
}

export class SceneTaskManager {
  /**
   * 取数任务时模糊搜索指标以添加组合
   *
   * @tags 场景任务管理
   * @request GET: /task-manager-scene/hint-metrics
   * @secure
   */
  getHintMetrics = (
    query: { metricsContent?: string; sceneId?: number } | GetHintMetrics_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityListGetNumMetricsVO>({
      url: `/task-manager-scene/hint-metrics`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 预览数据
   *
   * @tags 场景任务管理
   * @request POST: /task-manager-scene/preview-data
   * @secure
   */
  postPreviewData = (getNumTaskConfig: defs.GetNumTaskConfig, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager-scene/preview-data`,
      method: "POST",
      data: getNumTaskConfig,
      ...params,
    });

  /**
   * 保存任务
   *
   * @tags 场景任务管理
   * @request POST: /task-manager-scene/save-task
   * @secure
   */
  postSaveTask = (getNumTask: defs.GetNumTaskDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager-scene/save-task`,
      method: "POST",
      data: getNumTask,
      ...params,
    });

  /**
   * 场景信息详情
   *
   * @tags 场景任务管理
   * @request GET: /task-manager-scene/scene-detail/{id}
   * @secure
   */
  getSceneDetailById = ({ id }: { id: number } | GetSceneDetailById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityFetchSceneDetailVO>({
      url: `/task-manager-scene/scene-detail/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 修改任务
   *
   * @tags 场景任务管理
   * @request POST: /task-manager-scene/update-task
   * @secure
   */
  postUpdateTask = (getNumTask: defs.GetNumTaskDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/task-manager-scene/update-task`,
      method: "POST",
      data: getNumTask,
      ...params,
    });
}

export default new SceneTaskManager();
